<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      class Star {
        constructor(uname, fans) {
          this.uname = uname
          this.fans = fans
        }
        dance() {
          console.log('背' + this.uname + '带裤')
        }
        rap() {
          console.log('只' + this.fans + '因你太美')
        }
      }
      class Son extends Star {
        constructor(x, y, z) {
          // 作为函数调用，将参数传入父类的constructor中
          super(x, y)
          // 添加自己的属性
          this.z = z
          // 作为父类实例化对象，调用父类的方法
          super.dance()
        }
      }
      const son = new Son('zs', 'li', 'wu')
      console.log(son)
      son.rap()
    </script>
  </body>
</html>
